<?php
/**
 * 活动管理
 * User: cxm
 * Date: 2020/9/24
 * Time: 9:13
 */
namespace Seeds\Admin;
use App\Models\AdminPermission;
class ActivitySeeder {
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public static function run(){
        // 活动管理 (1级)
        $activity = AdminPermission::create([
            'pid' => 0, 'sort' => 100, 'http_method' => ['GET'], 'name' => '活动管理', 'fid' => null, 'icon' => 'el-icon-orange',
            'http_path' => 'javascript', 'menu_switch' => 2,'slug'=>'activity'
        ]);

        /** ------------------------------------------ 活动管理start --------------------------------------------------*/

        $index = AdminPermission::create([
            'pid' => $activity->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '活动管理', 'fid' => null, 'icon' => '',
            'url'=>'activity_list','http_path' => 'javascrip:;', 'menu_switch' => 2
        ]);
        // 列表
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => $index->id, 'icon' => '',
            'http_path' => '/admin/activity/getLists', 'menu_switch' => 1
        ]);
        // 所有
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '所有活动', 'fid' => $index->id, 'icon' => '',
            'http_path' => '/admin/activity/getAll', 'menu_switch' => 1
        ]);

        // 添加、编辑处理
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '添加、编辑处理', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/store', 'menu_switch' =>1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/delete', 'menu_switch' =>1
        ]);

        // 状态修改
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '状态修改', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/updateStatus', 'menu_switch' =>1
        ]);

        // 排序修改
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '排序', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/updateSort', 'menu_switch' =>1
        ]);

        // 中奖记录
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '中奖记录', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/historyList', 'menu_switch' =>1
        ]);

        // 兑奖
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '兑奖', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/historyPrize', 'menu_switch' =>1
        ]);

         AdminPermission::create([
             'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '添加、编辑用户兑奖信息', 'fid' => null, 'icon' => '',
             'http_path' => '/admin/activity/userDrawInfo', 'menu_switch' =>1
         ]);
         // 导出
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST','GET'], 'name' => '导出', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/historyExport', 'menu_switch' =>1
        ]);
        /** ------------------------------------------ 活动管理end --------------------------------------------------*/


        /** ------------------------------------------ 活动商品管理start --------------------------------------------------*/

//        $goods = AdminPermission::create([
//            'pid' => $activity->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '活动商品管理', 'fid' => null, 'icon' => '',
//            'url'=>'activity_goods','http_path' => 'javascrip:;', 'menu_switch' => 2
//        ]);
        // 列表
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/goods/getLists', 'menu_switch' => 1
        ]);

        // 详情
         AdminPermission::create([
             'pid' => $index->id, 'sort' => 20, 'http_method' => ['POST'], 'name' => '详情', 'fid' => null, 'icon' => '',
             'http_path' => '/admin/activity/goods/detail', 'menu_switch' => 1
         ]);

        // 添加、编辑处理
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '添加、编辑处理', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/goods/store', 'menu_switch' =>1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/goods/delete', 'menu_switch' =>1
        ]);

        // 状态修改
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '状态修改', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/goods/updateStatus', 'menu_switch' =>1
        ]);

        // 排序修改
        AdminPermission::create([
            'pid' => $index->id, 'sort' =>50, 'http_method' => ['POST'], 'name' => '排序', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/activity/goods/updateSort', 'menu_switch' =>1
        ]);
        /** ------------------------------------------ 活动商品管理end --------------------------------------------------*/

        /** ------------------------------------------ 活动商品管理start --------------------------------------------------*/
        $prize = AdminPermission::create([
            'pid' => $activity->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '中奖记录', 'fid' => null, 'icon' => '',
            'url'=>'write_award','http_path' => 'javascript:;', 'menu_switch' => 1
        ]);
        // 列表
        AdminPermission::create([
            'pid' => $prize->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => $index->id, 'icon' => '',
            'http_path' => '/admin/activity/historyList', 'menu_switch' => 1
        ]);
        /** ------------------------------------------ 活动商品管理end --------------------------------------------------*/

    }
}